import { users } from '../db.js'
export default [
    {
        url: '/api/login',
        method: 'post',
        response: ({ body }) => {
            const { username, password, code, phonenum } = body
            const user = users.find(item =>
                item.username === username &&
                item.password === password &&
                item.phonenum === phonenum
            )
            if (user) {
                if (code === '1234') {
                    return {
                        code: 200,
                        token: 'yijingdengluchenggong',
                    }
                }
                return {
                    code: 0,
                    message: '验证码错误'
                }
            }
            return {
                code: 0,
                message: '用户名不存在或密码错误'
            }
        }
    }
]